#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <Rectangle.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Rectangle)
{
	TEST(should Not be able to instantiate the rectangle(-2,3))
	{
		Rectangle rectangle(-2,3);

		ASSERT_EQ(0, rectangle.getArea());
	}

	TEST(should Not be able to instantiate the rectangle(20,110.0))
	{
		Rectangle rectangle(20,110.0);

		ASSERT_EQ(0, rectangle.getArea());
	}

	TEST(should be able to instantiate the rectangle(20,100.000))
	{
		Rectangle rectangle(20,100.000);

		ASSERT_NE(0, rectangle.getArea());
	}

	TEST(should be able to calculate the area of the rectangle(2,100.00))
	{
		Rectangle rectangle(2,100.00);

		ASSERT_EQ(200.00, rectangle.getArea());
	}

	TEST(should be able to calculate the perimeter of the rectangle(2,100.00))
	{
		Rectangle rectangle(2,100.00);

		ASSERT_EQ(204.00, rectangle.getPerimeter());
	}

	TEST(should be able to calculate the area of the rectangle(2.11,3.22), 2.11 * 3.22 = 6.7942 = 6.79)
	{
		Rectangle rectangle(2.11,3.22);

		ASSERT_EQ(rectangle.getRoundup(2.11 * 3.22), rectangle.getArea());
	}

	TEST(should be able to calculate the area of the rectangle, 2.11 * 3.456 = 7.2795 = 7.28)
	{
		Rectangle rectangle(2.11,3.456);

		ASSERT_EQ(rectangle.getRoundup(2.11 * 3.45), rectangle.getArea());
	}

	TEST(should be able to reset side len)
	{
		Rectangle rectangle(2.11,3.45);

		ASSERT_EQ(rectangle.getRoundup(2.11 * 3.45), rectangle.getArea());

		ASSERT_EQ(rectangle.getRoundup(2 * (2.11 + 3.45)), rectangle.getPerimeter());

		ASSERT_EQ(false, rectangle.setSideLen(0, 4.31));

		ASSERT_EQ(rectangle.getRoundup(2.11 * 3.45), rectangle.getArea());

		ASSERT_EQ(rectangle.getRoundup(2 * (2.11 + 3.45)), rectangle.getPerimeter());

		ASSERT_EQ(true, rectangle.setSideLen(3.68,4.31));

		ASSERT_EQ(rectangle.getRoundup(3.68 * 4.31), rectangle.getArea());

		ASSERT_EQ(rectangle.getRoundup(2 * (3.68 + 4.31)), rectangle.getPerimeter());
	}
};


